package com.astn.adapter.booking;

import java.util.ArrayList;

import com.astn.bks.R;
import com.astn.entity.booking.ProviderHolder;
import com.astn.entity.booking.QuoteUser;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class ProviderAdapter extends BaseAdapter {
	Context context;
	ArrayList<QuoteUser> lstItems = new ArrayList<QuoteUser>();
	LayoutInflater mInflater;

	public ProviderAdapter(Context ct, ArrayList<QuoteUser> lst) {
		this.context = ct;
		this.lstItems = lst;
		mInflater = LayoutInflater.from(context);
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return lstItems.size();
	}

	@Override
	public QuoteUser getItem(int position) {
		// TODO Auto-generated method stub
		return lstItems.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return lstItems.get(position).getId();
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		ProviderHolder holder;
		if (convertView == null) {
			convertView = mInflater.inflate(R.layout.provideritem, null);
			holder = new ProviderHolder();
			holder.txvInfo = (TextView) convertView.findViewById(R.id.txvInfo);
			convertView.setTag(holder);
		} else {
			holder = (ProviderHolder) convertView.getTag();
		}
		holder.txvInfo.setText(lstItems.get(position).getName());
		return convertView;
	}

}
